package com.coisini.mapper;

import com.coisini.annotation.AutoFill;
import com.coisini.dto.EmployeePageQueryDTO;
import com.coisini.entity.Employee;
import com.coisini.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmployeeMapper {

    /*
     * 根据用户名查询员工
     * @param username
     * @return
     */
    @Select("select * from skydelivery.employee where username = #{username}")
    Employee getByUsername(String username);

    /**
     * 新增员工
     * @param employee
     */
    @AutoFill(value = OperationType.INSERT)
    void insert(Employee employee);

    /**
     * 员工分页查询
     * @param employeePageQueryDTO
     * @return
     */
    List<Employee> pageQuery(EmployeePageQueryDTO employeePageQueryDTO);


    /**
     * 所有有关修改员工数据
     *
     */
    @AutoFill(value = OperationType.UPDATE)
    void update(Employee employee);

    /**
     * 根据id查询员工
     * @param id
     * @return
     */
    @Select("select  * from employee where id =#{id}")
    Employee getById(Long id);
}
